﻿@using KPIS.GERP.MVC.Classes
@model KPIS.GERP.SERVICE.Model.hrm_ps_commands

@{
    ViewBag.Title = "Details";
}
@using (Html.BeginForm())
{
    @* @Html.AntiForgeryToken() *@
    @Html.ValidationSummary(true)
<div style="margin-left:100px; margin-bottom:30px; float:left;">
<h2>คำสั่งเลขที่ @Model.cmd_ref_no</h2>
<h3 class="header">รายละเอียดคำสั่ง</h3>
    <div class="detail">

    <table class="info">
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.cmd_flag)
            </td>
            <td class="display-field">
                @Model.GetFlagName
            </td>
        </tr>
        <tr>
            <td class="display-label">
                @Html.DisplayNameFor(model => model.cmd_draft_no)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.cmd_draft_no)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.cmd_name)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.cmd_name)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.cmd_descr)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.cmd_descr)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.cmd_ref_no)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.cmd_ref_no)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.cmd_type_seq)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.cmd_type_seq)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.emp_type_seq)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.emp_type_seq)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.job_site_seq)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.job_site_seq)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.penalty_seq)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.penalty_seq)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.cmd_status)
            </td>
            <td class="display-field">
                @Model.GetCmdStatusName
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.approved_type)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.approved_type)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.approved_seq)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.approved_seq)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.approved_name)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.approved_name)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.approved_positions)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.approved_positions)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.approved_date)
            </td>
            <td class="display-field">
                @*@Html.DisplayFor(model => model.approved_date)*@
                @Common.GetLongDateString(Model.approved_date)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.cmd_rpt_date)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.cmd_rpt_date)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.inv_type_seq)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.inv_type_seq)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.confirm)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.confirm)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.rpt_header)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.rpt_header)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.remarks)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.remarks)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                @Html.LabelFor(model => model.record_status)
            </td>
            <td class="display  -field">
                @Common.GetRecordStatusName(Model.record_status)
            </td>
        </tr>
        @*<tr>
            <td class="display-label">
                @Html.DisplayNameFor(model => model.created_by)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.created_by)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.created_when)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.created_when)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.updated_by)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.updated_by)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                 @Html.DisplayNameFor(model => model.updated_when)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.updated_when)
            </td>
        </tr>*@
    </table>

    <br />

    <table class="tablesorter">
        <thead>
            <tr>
                @*<th>
                    @Html.DisplayNameFor(model => model.hrm_ps_command_dtls.emp_seq)
                </th>*@
                <th>
                    @Html.DisplayNameFor(model => model.hrm_ps_command_dtls.hrm_ps_employees.full_name)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.hrm_ps_command_dtls.start_date)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.hrm_ps_command_dtls.end_date)
                </th>
            </tr>
        </thead>
        <tbody>
        @foreach (var item in Model.col_hrm_ps_command_dtls)
        {
            <tr>
                @*<td>
                    @Html.DisplayFor(modelItem => item.emp_seq)
                </td>*@
                <td>
                    @Html.DisplayFor(modelItem => item.hrm_ps_employees.full_name)
                </td>
                <td>
                    @Common.GetLongDateString(item.start_date)
                    @*@Html.DisplayFor(modelItem => (item.start_date.HasValue ? item.start_date.Value.ToLongDateString() : ""))*@
                    @*@Html.DisplayFor(modelItem => item.start_date, "ViewDateLong")*@
                </td>
                <td>
                    @Common.GetLongDateString(item.end_date)
                    @*@Html.DisplayFor(modelItem => (item.end_date.HasValue ? item.end_date.Value.ToLongDateString() : ""))*@
                    @*@Html.DisplayFor(modelItem => item.end_date, "ViewDateLong")*@
                </td>
            </tr>
        }
        </tbody>

    </table>



<p>
    @if (Model.record_status != "A" && Model.record_status != "P")
    {
        <input type="submit" value="ส่งอนุมัติ" />
        @Html.ActionLink("แก้ไข", "Edit", new { id=Model.cmd_seq })@Html.Raw("&nbsp;|&nbsp;")
        @*@Html.ActionLink("ส่งอนุมัติ", "Approve", new { id = Model.cmd_seq })@Html.Raw("|")*@
    }
    @if(Model.record_status == "A")
    {
        @Html.ActionLink("ให้คำสั่งมีผลเดี๋ยวนี้", "UpdateCommand", new { id=Model.cmd_seq })@Html.Raw("&nbsp;|&nbsp;")
    }
    @Html.ActionLink("กลับไปหน้าแสดงรายการทั้งหมด", "Index")
</p>
        </div>
</div>
}